#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
using namespace std;
int main(){
	int n,k,x;
	cin >> n >> k >> x;
	vector<vector<int> > list(n,vector<int>(n));
	for(int i = 0;i < n;i++){
		for(int j = 0;j < n;j++){
			cin >> list[i][j];
		}
	}
	int temp = 1;
	for(int i = 0;i < n;i+=2){
		list[i].insert(list[i].begin(),temp++,x);
		if(temp>k) temp = 1;
	}
	int flag = 0;
	for(int i = 0;i < n;i++){
		int sum = 0;
		for(int j = 0;j < n;j++){
			sum += list[j][i];
		}
		if(flag) cout << " ";
		flag = 1;
		cout << sum;
	}
	return 0;
}
